home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / kernel / stvdu.c.D < prev    next >
Text File  |  1990-07-25  |  9KB  |  344 lines

  1. *** /tmp/,RCSt1022350    Wed Jul 25 13:56:17 1990
  2. --- stvdu.c    Mon Jul 23 22:35:32 1990
  3. ***************
  4. *** 1,2 ****
  5. ! #ifdef ATARI_ST
  6.   /*
  7. --- 1,7 ----
  8. ! #if (CHIP == M68000)
  9. ! /* This driver does not deal with multiple consoles and parameter passing
  10. !    through tp. Also the tty struct fields row and column are not maintained
  11. ! */
  12.   /*
  13. ***************
  14. *** 4,8 ****
  15.    */
  16. ! #include "../h/const.h"
  17. ! #include "../h/type.h"
  18. ! #include "../h/sgtty.h"
  19.   
  20. --- 9,12 ----
  21.    */
  22. ! #include "kernel.h"
  23. ! #include <sgtty.h>
  24.   
  25. ***************
  26. *** 12,14 ****
  27.   
  28. - #include "const.h"
  29.   #include "tty.h"
  30. --- 16,17 ----
  31. ***************
  32. *** 45,53 ****
  33.   
  34. - EXTERN char font16[];
  35. - EXTERN char font8[];
  36.   /*===========================================================================*
  37. !  *                start                         *
  38.    *===========================================================================*/
  39. ! PRIVATE int start(tp)
  40.   register struct tty_struct *tp;
  41. --- 48,53 ----
  42.   
  43.   /*===========================================================================*
  44. !  *                flush                         *
  45.    *===========================================================================*/
  46. ! EXTERN void flush(tp)
  47.   register struct tty_struct *tp;
  48. ***************
  49. *** 54,58 ****
  50.   {
  51. !   if (tp->tty_outleft == 0)
  52. !     return(1);
  53.     vducursor(0);
  54.     do {
  55. --- 54,61 ----
  56.   {
  57. !   register char *rq;
  58. !   if (tp->tty_rwords == 0)
  59. !     return;
  60.     vducursor(0);
  61. +   rq = (char *)tp->tty_ramqueue;
  62.     do {
  63. ***************
  64. *** 60,65 ****
  65.           vducursor(1);
  66. !         return(0);
  67.       }
  68. !     vduput(*((char *)tp->tty_phys));
  69. !                 /* write 1 byte to terminal */
  70.       tp->tty_phys++;        /* advance physical data pointer */
  71. --- 63,67 ----
  72.           vducursor(1);
  73. !         return;
  74.       }
  75. !     out_char(tp, *rq++);    /* write 1 byte to terminal */
  76.       tp->tty_phys++;        /* advance physical data pointer */
  77. ***************
  78. *** 66,70 ****
  79.       tp->tty_cum++;        /* number of characters printed */
  80. !   } while (--tp->tty_outleft != 0);
  81.     vducursor(1);
  82. !   return(1);
  83.   }
  84. --- 68,72 ----
  85.       tp->tty_cum++;        /* number of characters printed */
  86. !   } while (--tp->tty_rwords != 0);
  87.     vducursor(1);
  88. !   return;
  89.   }
  90. ***************
  91. *** 72,81 ****
  92.   /*===========================================================================*
  93. !  *                echo                          *
  94.    *===========================================================================*/
  95. ! PRIVATE echo(tp, c)
  96. ! register struct tty_struct *tp;
  97.   {
  98.     vducursor(0);
  99. !   vduput(c);
  100.     vducursor(1);
  101.   }
  102. --- 74,126 ----
  103.   /*===========================================================================*
  104. !  *                console                         *
  105.    *===========================================================================*/
  106. ! PRIVATE void console(tp)
  107. ! register struct tty_struct *tp;    /* tells which terminal is to be used */
  108.   {
  109. + /* Copy as much data as possible to the output queue, then start I/O.  On
  110. +  * memory-mapped terminals, such as the IBM console, the I/O will also be
  111. +  * finished, and the counts updated.  Keep repeating until all I/O done.
  112. +  */
  113. +   int count = 0;
  114. +   char c;
  115. + #if (CHIP == M68000)
  116. +   char *charptr = (char *)tp->tty_phys;
  117.     vducursor(0);
  118. ! #else
  119. !   extern char get_byte();
  120. !   unsigned segment, offset, offset1;
  121. !   /* Loop over the user bytes one at a time, outputting each one. */
  122. !   segment = (tp->tty_phys >> 4) & WORD_MASK;
  123. !   offset = tp->tty_phys & OFF_MASK;
  124. !   offset1 = offset;
  125. ! #endif
  126. !   while (tp->tty_outleft > 0 && tp->tty_inhibited == RUNNING) {
  127. ! #if (CHIP == M68000)
  128. !     out_char(tp, *charptr++);    /* write 1 byte to terminal */
  129. !     count++;
  130. ! #else
  131. !     c = get_byte(segment, offset);    /* fetch 1 byte from user space */
  132. !     out_char(tp, c);    /* write 1 byte to terminal */
  133. !     offset++;        /* advance one character in user buffer */
  134. ! #endif
  135. !     tp->tty_outleft--;    /* decrement count */
  136. !   }
  137. ! #if (CHIP == M68000)
  138.     vducursor(1);
  139. + #endif
  140. +   flush(tp);            /* clear out the pending characters */
  141. +   /* Update terminal data structure. */
  142. + #if (CHIP != M68000)
  143. +   count = offset - offset1;    /* # characters printed */
  144. + #endif
  145. +   tp->tty_phys += count;    /* advance physical data pointer */
  146. +   tp->tty_cum += count;        /* number of characters printed */
  147. +   /* If all data has been copied to the terminal, send the reply. */
  148. +   if (tp->tty_outleft == 0) finish(tp, tp->tty_cum);
  149.   }
  150. ***************
  151. *** 83,85 ****
  152.   /*===========================================================================*
  153. !  *                vduput                          *
  154.    *===========================================================================*/
  155. --- 128,130 ----
  156.   /*===========================================================================*
  157. !  *                out_char                     *
  158.    *===========================================================================*/
  159. ***************
  160. *** 88,90 ****
  161.    */
  162. ! PUBLIC vduput(c)
  163.   register c;            /* character to be output */
  164. --- 133,136 ----
  165.    */
  166. ! PUBLIC void out_char(tp, c)
  167. ! struct tty_struct *tp;    /* not yet used */
  168.   register c;            /* character to be output */
  169. ***************
  170. *** 153,154 ****
  171. --- 199,201 ----
  172.     register i;
  173. +   register struct tty_struct *tp = &tty_struct[CONSOLE];
  174.     
  175. ***************
  176. *** 161,164 ****
  177.       do
  178. !         if ((tty_struct[CONSOLE].tty_mode & XTABS) == XTABS)
  179. !             vduput(' ');
  180.           else
  181. --- 208,211 ----
  182.       do
  183. !         if ((tp->tty_mode & XTABS) == XTABS)
  184. !             out_char(tp, ' ');
  185.           else
  186. ***************
  187. *** 168,171 ****
  188.     case 012: /* LF */
  189. !     if (tty_struct[CONSOLE].tty_mode & CRMOD)
  190. !         vduput('\r');
  191.     case 013: /* VT */
  192. --- 215,218 ----
  193.     case 012: /* LF */
  194. !     if (tp->tty_mode & CRMOD)
  195. !         out_char(tp, '\r');
  196.     case 013: /* VT */
  197. ***************
  198. *** 259,260 ****
  199. --- 306,308 ----
  200.       return;
  201. + #if (CHIP != M68000)
  202.   #ifdef NEEDED
  203. ***************
  204. *** 265,266 ****
  205. --- 313,315 ----
  206.   #endif NEEDED
  207. + #endif
  208.     case 'm': /* SGR: set graphic rendition */
  209. ***************
  210. *** 326,329 ****
  211.     case 'h': /* SM: set mode */
  212. !     if (v->next[0] == '?' && v->next[1] == '5' && v->mono)
  213. !         VIDEO->vd_rgb[0] = c == 'l' ? RGB_BLACK : RGB_WHITE;
  214.       return;
  215. --- 375,382 ----
  216.     case 'h': /* SM: set mode */
  217. !     if (v->next[0] == '?') { /* DEC private modes */
  218. !         if (v->next[1] == '5' && v->mono) /* DECSCNM */
  219. !             VIDEO->vd_rgb[0] = c == 'l' ? RGB_BLACK : RGB_WHITE;
  220. !         else if (v->next[1] == '1')      /* DECCKM */
  221. !             app_mode = c == 'l' ? TRUE : FALSE;
  222. !     }
  223.       return;
  224. ***************
  225. *** 362,364 ****
  226.   
  227. !         w = &VIDEO->vd_rgb[j & 0x0F];
  228.           j = vduparam();
  229. --- 415,417 ----
  230.   
  231. !         w = (short *)&VIDEO->vd_rgb[j & 0x0F];
  232.           j = vduparam();
  233. ***************
  234. *** 402,403 ****
  235. --- 455,462 ----
  236.       return;
  237. +   case '=': /* DECKPAM: keypad application mode */ 
  238. +     keypad = TRUE;
  239. +     return;
  240. +   case '>': /* DECKPNM: keypad numeric mode */ 
  241. +     keypad = FALSE;
  242. +     return;
  243.     case 'E': /* NEL: next line */
  244. ***************
  245. *** 417,420 ****
  246.     case 'c': /* RIS: reset to initial state */
  247. !     vduinit(&tty_struct[CONSOLE]);
  248.       vducursor(0);
  249.       return;
  250. --- 476,481 ----
  251.     case 'c': /* RIS: reset to initial state */
  252. !     vduinit();
  253.       vducursor(0);
  254. +     keypad = FALSE;
  255. +     app_mode = FALSE;
  256.       return;
  257. ***************
  258. *** 643,646 ****
  259.   {
  260. !   register char *vp;        /* ptr into video memory */
  261. !   register char *fp;        /* ptr into font */
  262.     register nl;            /* scan lines per char */
  263. --- 704,707 ----
  264.   {
  265. !   register unsigned char *vp;    /* ptr into video memory */
  266. !   register unsigned char *fp;    /* ptr into font */
  267.     register nl;            /* scan lines per char */
  268. ***************
  269. *** 657,659 ****
  270.       nl = v->linc;
  271. !     vp = v->curs;
  272.       if ((v->attr & 1) == 0) {
  273. --- 718,720 ----
  274.       nl = v->linc;
  275. !     vp = (unsigned char *)v->curs;
  276.       if ((v->attr & 1) == 0) {
  277. ***************
  278. *** 673,675 ****
  279.       fp -= nl;
  280. !     vp = v->curs + 2;
  281.       if ((v->attr & 2) == 0) {
  282. --- 734,736 ----
  283.       fp -= nl;
  284. !     vp = (unsigned char *)v->curs + 2;
  285.       if ((v->attr & 2) == 0) {
  286. ***************
  287. *** 695,697 ****
  288.    */
  289. ! PUBLIC vducursor(onoff)
  290.   int    onoff;
  291. --- 756,758 ----
  292.    */
  293. ! PUBLIC void vducursor(onoff)
  294.   int    onoff;
  295. ***************
  296. *** 725,727 ****
  297.    *===========================================================================*/
  298. ! PUBLIC vduinit()
  299.   {
  300. --- 786,788 ----
  301.    *===========================================================================*/
  302. ! PUBLIC void vduinit()
  303.   {
  304. ***************
  305. *** 7